const defaultOptions = {
    expires : 7,
    path: ''
}

export const setCookie = (name, value, options = defaultOptions) => {
    let d = new Date();
    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
    let expires = "expires=" + d.toGMTString();
    document.cookie = name + "=" + value + "; " + expires;
};

export const getCookie = (name) => {
    let ret, m;
    if (typeof name === 'string' && name !== '') {
        if ((m = String(document.cookie).match(
            new RegExp('(?:^| )' + name + '(?:(?:=([^;]*))|;|$)')))) {
            ret = m[1] ? decodeURIComponent(m[1]) : '';
        }
    }
    return ret;
}